package cn.crc.pjblog.components;

import org.apache.tapestry5.ComponentResources;
import org.apache.tapestry5.MarkupWriter;
import org.apache.tapestry5.annotations.Environmental;
import org.apache.tapestry5.ioc.annotations.Inject;
import org.apache.tapestry5.corelib.base.AbstractField;
import org.apache.tapestry5.services.FormSupport;
import org.apache.tapestry5.services.Heartbeat;
import org.apache.tapestry5.services.Request;

public final class Button extends AbstractField {
	
	static final String SELECTED_EVENT ="selected";
	
	@Environmental
	private Heartbeat  heartBeat;
	
	
	@Inject 
	private ComponentResources  resources;
	
	@Inject
	private Request request;
	
	
//	public Button()
//    {
//    }
//
//    Button(Request request)
//    {
//        this.request = request;
//    }
    
	   void setup(ComponentResources resources, Heartbeat heartbeat)
	    {
	        this.resources = resources;
	       
	        this.heartBeat = heartbeat;
	    }
		
	
	void beginRender(MarkupWriter writer){
//		System.out.println("beginRender from button component ");
		writer.element("input", "type","button","name",this.getControlName(),"id",getClientId());
		this.resources.renderInformalParameters(writer);
	}
	
	void afterRender(MarkupWriter writer){
//		System.out.println("afterRender from button components ");
		writer.end();
	}


	/* (non-Javadoc)
	 * @see org.apache.tapestry.corelib.base.AbstractField#processSubmission(java.lang.String)
	 */
	@Override
	protected void processSubmission(String arg0) {
		// TODO Auto-generated method stub
		
	}
	
	
}
	
